@extends('plugin.layout.baseDoing')
@section('add_css')

@endsection
@section('content')
    <div class="layui-form layui-form-kongqi" id="layuiadmin-form" id="layuiadmin-form">
        {{ csrf_field() }}
          @include('plugin.tpl.form.select',[
             'data'=>[
                 'name'=>'status',
                 'title'=>'订单状态',
                 'tips'=>'',
                 'on_id'=>'1',
                 'rq'=>'rq',
                 'filter'=>'type',
                 'list'=>[
                      'type'=>'key_value',
                      'data'=>$status
                 ]
             ]])

            <div class="layui-form-item">
                <label class="layui-form-label">
                    <strong class="item-required">*</strong>
                    发布者
                </label>
                <div class="layui-input-block">
                    <select class="layui-input" id="id_select2_demo1" name="user_id" lay-ignore lay-verify="rq">
                        <option value="">-----请选择-----</option>

                    </select>
                </div>
            </div>
            @include('plugin.tpl.form.select',[
               'data'=>[
                   'name'=>'type',
                   'title'=>'订单类型',
                   'tips'=>'',
                   'on_id'=>'',
                   'rq'=>'rq',
                   'filter'=>'type',
                   'list'=>[
                        'type'=>'key_value',
                        'data'=>$type
                   ]
               ]])
            @include('plugin.tpl.form.text',[
                   'data'=>[
                       'name'=>'money',
                       'title'=>'支付金额',
                       'tips'=>'',
                       'value'=>'',
                       'rq'=>'rq|number'
                   ]])
            <div class="type-area"></div>
            @include('plugin.tpl.form.date',[
                    'data'=>[
                        'name'=>'pay_at',
                        'title'=>'支付时间',
                        'tips'=>'',
                        'value'=>'',
                        'rq'=>'rq'
                    ]])



            @include('plugin.tpl.form.textarea',[
              'data'=>[
                  'name'=>'mark',
                  'title'=>'备注',
                  'tips'=>'',
                  'value'=>'',
                  'rq'=>'rq'
              ]])

        @include('plugin.tpl.form.submit')


    </div>
    <div class="type-hide" style="display: none">
        <div class="type-vip">

            @include('plugin.tpl.form.select',[
             'data'=>[
                 'name'=>'vip_level',
                 'title'=>'VIP等级',
                 'tips'=>'',
                 'on_id'=>'vip',
                 'rq'=>'rq',
                 'list'=>[
                      'type'=>'',
                      'data'=>$level
                 ]
             ]])
        </div>
        <div class="type-gold">
            @include('plugin.tpl.form.text',[
            'data'=>[
                'name'=>'gold',
                'title'=>'金币',
                'tips'=>'',
                'value'=>'',
                'rq'=>'rq|number'
            ]])
        </div>
    </div>
@endsection
@section('foot_js')
    @include('plugin.forum.admin.user.select2')
    <script>
        layui.use(['index','form'], function () {
            var form=layui.form;
            select2_user("#id_select2_demo1")
            form.on('select(type)', function (data) {
                console.log(data.elem); //得到select原始DOM对象
                console.log(data.value); //得到被选中的值
                console.log(data.othis); //得到美化后的DOM对象

                $(".type-area").empty().append($(".type-" + data.value).html());
                form.render();

            });

            $('#money').on('input propertychange', function()
            {
                var type=$("#type").val();
                if(type=='gold')
                {
                    //取得比例
                    var ratio="{{ \App\Plugin\Forum\Models\PnForumUser::moneyTransGoldRatio() }}";
                    console.log(ratio);
                    $("#gold").val(parseInt(ratio)*$(this).val());
                }
                //获取input 元素,并实时监听用户输入
                //逻辑
            })
        })
    </script>

@endsection